<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/include/taglib.jsp" %>
<html>
<head>
    <title>学校资产</title>
    <%@ include file="../../include/head.jsp" %>
    <style>
        .tpl-content-wrapper {
            margin-left: 0
        }
    </style>
</head>
<body>
<script src="${ctxStatic}/assets/js/theme.js"></script>
<div class="am-g tpl-g">
    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title am-fl">学校资产</div>
                        </div>
                        <div class="widget-body am-fr">
                            <form class="am-form tpl-form-border-form" data-am-validator modelAttribute="asset"
                                  action="${ctx}/asset/<c:choose><c:when test="${empty asset.id}">create</c:when><c:otherwise>update</c:otherwise></c:choose>"
                                  method="post">
                                <input type="hidden" name="id" value="${asset.id}"/>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">资产名称：</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" name="name" placeholder="资产名称" value="${asset.name}"
                                               required/>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">资产类型：</label>
                                    <div class="am-u-sm-9">
                                        <select data-am-selected name="assetType">
                                            <c:forEach items="${assetType}" var="type">
                                            <option value="${type.id}">${type.configValue}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label"><span class="error">*</span>资产所属部门：</label>
                                    <div class="am-u-sm-5">
                                        <div class="am-input-group">
                                            <input type="text" id="parentName" class="am-form-field"
                                                   value="${asset.organization.name}" readonly/>
                                            <input type="hidden" id="parentId" name="organizationId"
                                                   value="${asset.organization.id}" required/>
                                            <span class="am-input-group-btn">
							        <button class="am-btn am-btn-primary" id="menuBtn" type="button">选择</button>
							      </span>
                                        </div>
                                    </div>
                                    <label class="am-u-sm-4"></label>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">资产性质：</label>
                                    <div class="am-u-sm-9">
                                        <select data-am-selected name="assetNature">
                                            <option value="0">资产</option>
                                            <option value="1" selected>费用</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">增长类型：</label>
                                    <div class="am-u-sm-9">
                                        <select data-am-selected name="addType">
                                            <option value="0">购入需安装已完工的固定资产</option>
                                            <option value="1" selected>其他单位转入的固定资产(新设备)</option>
                                            <option value="2">其他单位转入的固定资产(旧设备)</option>
                                            <option value="3">捐赠的固定资产</option>
                                            <option value="4" disabled>融资租赁的固定资产</option>
                                            <option value="5" disabled>固定资产盘盈 </option>
                                        </select>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">资产旧值：</label>
                                    <div class="am-u-sm-9">
                                        <input type="number" name="cost" placeholder="资产旧值" value="${asset.cost}"
                                               required/>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">资产累计折旧：</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" name="accDeperciation" placeholder="资产累计折旧"
                                               value="${asset.accDeperciation}" required/>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">折旧率：</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" name="depreciationRate" placeholder="折旧率"
                                               value="${asset.depreciationRate}" required/>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">合计年限：</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" name="depreciableLife" placeholder="z合计年限"
                                               value="${asset.depreciableLife}" required/>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">月折旧额：</label>
                                    <div class="am-u-sm-9">
                                        <input type="number" name="monthlyDepreciation" placeholder="月折旧额"
                                               value="${asset.monthlyDepreciation}" required/>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">资产保管人：</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" name="assetMgr" placeholder="资产保管人" value="${asset.assetMgr}"
                                               required/>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">领用时间：</label>
                                    <div class="am-input-group am-datepicker-date"
                                         data-am-datepicker="{format: 'yyyy-mm-dd'}">
                                        <input type="text" name="holdDate" class="am-form-field" value="${asset.holdDate}" placeholder="领用时间" readonly>
                                        <span class="am-input-group-btn am-datepicker-add-on">
                                            <button class="am-btn am-btn-default" type="button"><span class="am-icon-calendar"></span> </button>
                                        </span>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">备注：</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" name="mark" placeholder="备注" value="${asset.mark}" required/>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <div class="am-u-sm-9 am-u-sm-push-3">
                                        <button type="submit" class="am-btn am-btn-primary">保存</button>
                                        <button type="button" class="am-btn am-btn-danger" onclick="closeModel(false)">
                                            关闭
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<%@ include file="../../include/bottom.jsp" %>
<script type="text/javascript">
    $(document).ready(function () {
        var msg = '${msg}';
        if (msg != '') {
            showMsg(msg);
            closeModel(true);//关闭窗口
        }
    });
</script>
</body>
</html>
